home *** CD-ROM | disk | FTP | other *** search
- #!/bin/csh -f
- # Installation script for MAEstro programmer libraries.
- # Copyright (C) 1994 by George D. Drapeau
- #
-
- set OsRelease = `uname -r` # What release of the operating system is this?
- switch ($OsRelease)
- case "4.*": # SunOS 4.X
- set RootDir = /cdrom/MAEstro/lib # Set top-level directory from which to retrieve MAEstro libraries
- set RootIncludeDir = /cdrom/MAEstro/include # This is where MAEstro include files are
- set SourceDir = /cdrom/MAEstro/SamplePrograms # Indicate where sample source code can be found
- breaksw
- case "5.*": # SunOS 5.X
- set RootDir = /cdrom/unnamed_cdrom/MAEstro/lib # Set top-level directory from which to retrieve MAEstro libraries
- set RootIncludeDir = /cdrom/unnamed_cdrom/MAEstro/include# This is where MAEstro include files are
- set SourceDir = /cdrom/unnamed_cdrom/MAEstro/SamplePrograms# Indicate where sample source code can be found
- breaksw
- default: # Probably not any SunOS
- set RootDir = /cdrom/MAEstro/lib # Set top-level directory from which to retrieve MAEstro libraries
- set RootIncludeDir = /cdrom/MAEstro/include # This is where MAEstro include files are
- set SourceDir = /cdrom/MAEstro/SamplePrograms # Indicate where sample source code can be found
- breaksw
- endsw
-
- set DestDir = "/usr/local/MAEstro" # Set up a default directory for the MAEstro libraries
- set OsType = `uname -s` # Determine the operating system type
-
- if ($OsType != "SunOS") then # Is this a Sun workstation? If not, exit now
- echo "This operating system is not SunOS. Please install from a Sun workstation."
- exit (-1)
- endif
-
- set OsRelease = `uname -r` # What release of the operating system is this?
- switch ($OsRelease)
- case "4.*": # SunOS 4.X
- echo "Installing MAEstro programmer libraries for SunOS 4.X."
- set OsDir = "SunOS4"
- breaksw
- case "5.*": # SunOS 5.X
- echo "Installing MAEstro programmer libraries for Solaris 2.X."
- set OsDir = "Solaris2"
- breaksw
- default: # Probably not any SunOS
- echo "You are using either an unknown version of SunOS or are installing"
- echo "from a non-Sun workstation. Please install from a Sun workstation"
- echo "for the installation to work correctly."
- exit (-1)
- breaksw
- endsw
-
- set MAEstroLibDir = "$RootDir/$OsDir" # Determine where to find the correct MAEstro libraries
-
- if (!(-e $MAEstroLibDir)) then
- echo "Cannot find the directory $RootDir. Please make sure"
- echo "that you have mounted the CD-ROM as /cdrom, then try"
- echo "this installation script again."
- exit (-1)
- endif
-
- set DiskSpaceNeeded = `du -s $MAEstroLibDir | awk '{print $1}'` # Determine disk space needed to install the MAEstro libraries
-
- echo ""
- echo "The default installation directory is "
- echo " $DestDir"
- echo ""
- echo "The MAEstro libraries require $DiskSpaceNeeded KB of disk space."
- echo ""
- echo "Would you like to install the MAEstro libraries into "
- echo -n "'$DestDir'? [y/n] "
- set DestDir_ok = $< # Ask the installer if the default directory is okay.
-
-
- CustomInstallDirectory: # Here begins code to install apps in a custom directory
-
- if ($DestDir_ok != y) then # The default directory is not okay, prompt for a new place
- echo ""
- echo "Where would you like to install the MAEstro libraries? "
- echo "(type 'q' to quit the installation process now.)"
- echo -n "--> "
- set DestDir = $<
- endif
-
- if ($DestDir == "q") then # Did the installer choose to exit without installing the software?
- echo "MAEstro programmer libraries were not installed."
- exit (-1) # Yes, honor that choice and quit right now
- endif
-
- if (!(-e $DestDir)) then # Does the specified directory exist?
- echo ""
- echo "The directory '$DestDir' does not exist."
- echo -n "Would you like to create it? [y/n] " # No, shall this program create such a directory?
- set create = $<
- if ($create == y) then # Yes, try to create the directory specified by the installer
- echo -n "Creating installation directory..."
- mkdir $DestDir >& /dev/null # Create the directory and set appropriate permissions
- if ($status != 0) then
- echo ""
- echo "Could not create the directory $DestDir."
- echo "Please try another directory name."
- echo ""
- goto CustomInstallDirectory
- endif
- chmod 0755 $DestDir
- echo "Done."
- else
- echo "Please try again:"
- echo ""
- goto CustomInstallDirectory
- endif
- else
- echo ""
- endif
-
- if (!(-e $DestDir/lib)) then # Does the "lib" directory exist?
- mkdir $DestDir/lib >& /dev/null # No, try to create it
- if ($status != 0) then # Did the creation fail?
- echo "" # Yes, report the error and exit without doing anything more
- echo "Could not create the directory $DestDir/lib."
- echo "Please make sure you have permission to create directories under"
- echo "$DestDir then run this installation script again."
- exit (-1)
- endif
- endif
-
- if (!(-e $DestDir/include)) then # Does the "include" directory exist?
- mkdir $DestDir/include >& /dev/null # No, try to create it
- if ($status != 0) then # Did the creation fail?
- echo "" # Yes, report the error and exit without doing anything more
- echo "Could not create the directory $DestDir/include."
- echo "Please make sure you have permission to create directories under"
- echo "$DestDir then run this installation script again."
- exit (-1)
- endif
- endif
-
- if (!(-e $DestDir/Source)) then # Does the "Source" directory exist?
- mkdir $DestDir/Source >& /dev/null # No, try to create it
- if ($status != 0) then # Did the creation fail?
- echo "" # Yes, report the error and exit without doing anything more
- echo "Could not create the directory $DestDir/Source."
- echo "Please make sure you have permission to create directories under"
- echo "$DestDir then run this installation script again."
- exit (-1)
- endif
- endif
-
-
- #
- # Avoid problems with long df entries...
- #
- set DF_LONG = `df $DestDir | tail -1 | awk '{print $4}' | egrep % | wc -c`
- if ( $DF_LONG == "0" ) then
- set FreeDiskSpace = `df $DestDir | tail -1 | awk '{print $4}'`
- else
- set FreeDiskSpace = `df $DestDir | tail -1 | awk '{print $3}'`
- endif
-
- if ($FreeDiskSpace < $DiskSpaceNeeded) then # Is there enough space to hold the MAEstro apps?
- echo "Sorry, the MAEstro programmer libraries require $DiskSpaceNeeded KB of free disk space" # No, inform the installer
- echo "but there are only $FreeDiskSpace KB free in '$DestDir'."
- echo "Please free up disk space or install MAEstro programmer libraries"
- echo "in a different directory, then run this installation script again."
- exit (-1) # Exit this script without doing any installation
- endif
-
-
- echo ""
- echo -n "Installing MAEstro programmer libraries into '$DestDir'..."
-
- cp $MAEstroLibDir/* $DestDir/lib # Copy the MAEstro libraries into the desired directory
- if ($OsDir == "SunOS4") then # Does "ranlib" need to be run on the installed libraries?
- pushd $DestDir/lib >& /dev/null # Yes, go to the installed directory and run "ranlib" for...
- ranlib *.a # ...each installed library.
- popd >& /dev/null
- endif
-
- cp $RootIncludeDir/* $DestDir/include >& /dev/null # Copy the MAEstro include files into the desired directory
- cp -r $SourceDir $DestDir/Source >& /dev/null # Copy the MAEstro sample programs into the desired directory
-
- echo "Done."
-
- echo ""
- echo 'Installation was successful. Enjoy\!'
-
- exit (0) # Installation was successful; get outtahere.
-